var list;
function zhuanf(ob) {
	if (ob.value != '0') {
		$(".zhtext").css('display', 'block');
	} else {
		$(".zhtext").css('display', 'none');
	}
}
$(function() {
	//专业列表
	list = '<s:property value="proJson" escape="false"/>';
	//学生类型列表
	subList = '<s:property value="subJson" escape="false"/>';
	//转换为对象
	list = eval("(" + list + ")");
	subList = eval("(" + subList + ")");
	for ( var a in list) {
		var temp = eval("list." + a);
		$("#op1").append("<option>" + a + "</option>");
		$("#dorm_profession").append("<option>" + a + "</option>");
		$('#op1').change(function() {
			if (this.options.selectedIndex == 0 ) {
				$('#op2').empty();
				$("#op2").append("<option>全部班级</option>");
			} else
				show($(this.options[this.options.selectedIndex]).val());
		})
		$('#dorm_profession').change(function() {
			if (this.options.selectedIndex == 0 ) {
				$('#dorm_classNO').empty();
				$("#dorm_classNO").append("<option>全部班级</option>");
			} else
				dromClass_show($(this.options[this.options.selectedIndex]).val());
		})
	}
	for ( var i = 0; i < subList.length; i++) {
		$('#op3').append("<option>" + subList[i] + "</option>");
	}

	//提交查询数据
	$('#stuSearch').click(function() {
		$.ajax( {
			url : "json/queryAction!queryStuInfo",
			dataType : "json",
			success : function(data, textStatus) {
				showResult(data)
		},
		error : function() {
			alert("查询出错了，请重试！");
		},
		data : {
			'examCode' : examCode,
			'studentName' : studentName,
			'idCode' : idCode,
			"date" : new Date()
		},
		async : true
		})
	});
})
function show(obj) {
	var temp = eval("list." + obj);
	$('#op2').empty();
	for ( var i = 1; i <= parseInt(temp); i++) {
		$("#op2").append("<option>" + i + "</option>");
	}
}
function dromClass_show(obj) {
	var temp = eval("list." + obj);
	$('#dorm_classNO').empty();
	for ( var i = 1; i <= parseInt(temp); i++) {
		$("#dorm_classNO").append("<option>" + i + "</option>");
	}
}